Spotify Playlist maker

Because why do 3 hours of manual listening and sorting yourself when you can spend a few days throwing together a classifier to do it for you?

Motivation

Are you someone who just clicks like on a newly discovered song, only to never organize them into playlists on a later date? No? Just me? Ok.... Well instead of spending a day organizing my 760 songs collected within my Spotify liked list, I chose to spend three days creating a collection of three scripts that can read, interpret, and group my songs into relatable playlists for me.

Implementation


Smart Curator Component Design


Data

The Spotify Web APIs are queried using Spotipy, where all 760 liked songs and respective audio features are recorded. The individual data streams are then combined to be stored as dataset in CSV format. It was worth noting that songs with Chinese titles were excluded from recording into CSV due to incompatibility with the encoding style.

Classifier

The dataset is imported and then preprocessed to only use the audio features, which are min max scaled before subjecting to K Means Clustering. Using a combination of the Elbow method and the Silhouette Method, the optimal K value is found to be either 2, or 7. As I try not to think of myself as a basic individual, I used 7 clusters as the means to categorize my music.


Elbow Method Graph



Silhouette Method Graph


The clustered songs are validated visually through a PCA dimensionally reduced graph, where two main clusters of music can be seen broken down into further categorizations based on colors.


PCA Dimensionally Reduced Graph


Satisfied with the initial iteration of clustering, the output labelling is combined with the song titles, artist, and song id to be saved in CSV format once again.

Maker

The clustered CSV is read, where playlists are automatically generated for each cluster and then populated with the respective clustered songs on Spotify. The songs are inputted in terms of their respective inertia to the cluster center, aka they are ranked based on their similarity to the vibe of the playlist.

Outcome

Auto categorization of all liked songs were achieved, although it was hard to differentiate between the different playlists as a lot of them give off a "funky" EDM vibe. How would you describe this cluster? Let me know if you think the clusters are well defined!